﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Yu.Cms.Common;

namespace Yu.Cms.Web.UserCtrl.Admin
{
    public partial class AlbumAdd : BaseCtrl
    {       
        protected void Page_Load(object sender, EventArgs e)
        {
            string strName = YuRequest.GetFormString("name");
            string strInfo = YuRequest.GetFormString("info");
            int intBigID = YuRequest.GetFormInt("bigid", 0);
            string Act = YuRequest.GetQueryString("act");
            

            btnSave.Visible = true;
            btnModify.Visible = false;          

            if (!IsPostBack)
            {
                int rInt = 0;
                if (Act.ToLower() == "add")
                {
                    Yu.Cms.Model.albumType malbumType = new Yu.Cms.Model.albumType();
                    malbumType.alBigName = strName.Trim();
                    malbumType.alBigInfo = strInfo;
                    malbumType.pubTime = DateTime.Now;
                    malbumType.alTopID = 0;
                    rInt = bllalbumType.Add(malbumType);
                    Response.Write(rInt);
                    Response.End();
                }
                else if(Act.ToLower()=="modify")
                {
                    int BigID = YuRequest.GetQueryInt("BigID");
                    Hid.Value = BigID.ToString();
                    Yu.Cms.Model.albumType malbumType = bllalbumType.GetModel(BigID);
                    txtBigName.Text = malbumType.alBigName;
                    txtBigInfo.Text = malbumType.alBigInfo;
                    btnSave.Visible = false;
                    btnModify.Visible = true;
                    
                }
                else if (Act.ToLower() == "modifyok")
                {
                    Yu.Cms.Model.albumType malbumType = bllalbumType.GetModel(intBigID);
                    malbumType.alBigName = strName.Trim();
                    malbumType.alBigInfo = strInfo;
                    malbumType.pubTime = DateTime.Now;  //修改时间
                    malbumType.alTopID = 0;
                    rInt = bllalbumType.Update(malbumType);
                    Response.Write(rInt);
                    Response.End();
                }

            }
        }

        protected void InsertAlbumType()
        {
            
        }

        
    }
}